package model;

import model.type.EntPerRelationType;
import db.ImbiConnection;

public class EnterprisePersonRelation {
	private final int id;
	private int person;
	private int enterprise;
	private int entPerRelationType;
	
	public EnterprisePersonRelation(int id, int person, int enterprise,
			int entPerRelationType) {
		super();
		this.id = id;
		this.person = person;
		this.enterprise = enterprise;
		this.entPerRelationType = entPerRelationType;
	}

	public int getPerson() {
		return person;
	}

	public void setPerson(int person) {
		this.person = person;
	}

	public int getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(int enterprise) {
		this.enterprise = enterprise;
	}

	public int getEntPerRelationType() {
		return entPerRelationType;
	}

	public void setEntPerRelationType(int entPerRelationType) {
		this.entPerRelationType = entPerRelationType;
	}

	public int getId() {
		return id;
	}
	
	/*OBJECT ACCESS METHODS*/
		
	public String typeString(){
		return EntPerRelationType.getEntPerRelationType(getEntPerRelationType()).getType();		
	}
	
	public Person getPersonObject(){
		return ImbiConnection.getPersonDAO().find(getPerson());
	}
	
	public Enterprise getEnterpriseObject(){
		return ImbiConnection.getEnterpriseDAO().find(getEnterprise());
	}
	
}
